package cn.com.dingtek.genius.manager.server.support;

import cn.com.dingtek.genius.manager.server.support.sam.Enforcer;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class AuthAction {
    public static final List<AuthAction> USER_ACTIONS;
    public static final List<AuthAction> AUTH_GROUP_ACTIONS;

    static {
        USER_ACTIONS = new ArrayList<>();
        USER_ACTIONS.add(new AuthAction("列表", 0, 0));
        USER_ACTIONS.add(new AuthAction("新增", 0, 1));
        USER_ACTIONS.add(new AuthAction("管理", 0, 2));
        USER_ACTIONS.add(new AuthAction("授权", 0, 3));
        USER_ACTIONS.add(new AuthAction("重置密码", 0, 4));
        USER_ACTIONS.add(new AuthAction("移除", 0, 5));

        AUTH_GROUP_ACTIONS = new ArrayList<>();
        AUTH_GROUP_ACTIONS.add(new AuthAction("列表", 0, 6));
        AUTH_GROUP_ACTIONS.add(new AuthAction("新增", 0, 7));
        AUTH_GROUP_ACTIONS.add(new AuthAction("管理", 0, 8));
        AUTH_GROUP_ACTIONS.add(new AuthAction("权限配置", 0, 9));
        AUTH_GROUP_ACTIONS.add(new AuthAction("移除", 0, 10));
    }

    public AuthAction(String action, Integer idx, Integer pos) {
        this.action = action;
        this.idx = idx;
        this.pos = pos;
        this.id = Enforcer.BytePolicy.key(idx, pos);
    }

    private String id;

    private String action;

    private Integer idx;

    private Integer pos;
}
